package remote.service;

import client.common.dto.GetOperationLogByPageDto;
import client.common.result.Result;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.TypeReference;
import remote.common.constant.UrlConstant;
import remote.common.storage.TokenStorage;

import java.util.Map;

/**
 * 日志服务接口
 */
public interface LogService {
    
    /**
     * 分页获取操作日志
     */
    default Result<Map<String, Object>> getOperationLogListByPage(GetOperationLogByPageDto getApiLogByPageDto) {
        String resultStr = HttpRequest.get(UrlConstant.LOG_URL + "/log/getOperationLogByPage")
                .header("Authorization", TokenStorage.getToken())
                .body(JSON.toJSONString(getApiLogByPageDto))
                .execute().body();
        return JSON.parseObject(resultStr, new TypeReference<Result<Map<String, Object>>>() {
        });
    }
}
